package com.ljsw.util;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;

import com.ljsw.activity.R;

/**
 * Created by lianchao on 2020/9/15.
 */

public class ShowToastUtils {
    private Context  mContext;

    /**
     * 自定义 toast， 增大字体
     *
     * @param info     提示信息
     * @param duration 显示时间，0：短时间，1：长时间
     */
    public  void showBigToast(String info, int duration) {
        Toast toast = new Toast(mContext);
        toast.setGravity(Gravity.CENTER, 0, 0);
        TextView tv = new TextView(mContext);
        tv.setBackgroundResource(R.drawable.bg_toast);
        tv.setGravity(Gravity.CENTER);
        tv.setPadding(25, 5, 25, 5);
        tv.setTextColor(Color.WHITE);
        tv.setText(info);
        tv.setTextSize(30);
        toast.setView(tv);
        toast.setDuration(duration);
        toast.show();
    }
}
